import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { RoleEntity } from 'src/modules/role/entities/role.entity';
import { Repository } from 'typeorm';
import { AccountEntity } from '../../entities/account.entity';

@Injectable()
export class AccountService {
  constructor(
    @InjectRepository(AccountEntity, 'nest_test1')
    private readonly accountRepository: Repository<AccountEntity>,
    @InjectRepository(RoleEntity, 'nest_test2')
    private readonly roleRepository: Repository<RoleEntity>,
  ) {}

  async accountList(): Promise<any> {
    const roleList = await this.roleRepository.find(); // rolelist即是第二个数据库nest_test2
    console.log(roleList, '角色列表');
    return await this.accountRepository.find(); // account存储在第一个数据库nest_test1
  }
}
